﻿using System.Collections.Generic;
using System.Windows;

namespace POBR.ImageProcessor
{
	public class SegmentFilter
	{
		public IEnumerable<Int32Rect> FilterSegments(Picture picture, IEnumerable<Int32Rect> segments)
		{
			var result = new List<Int32Rect>();

			foreach (var segment in segments)
			{
				for (int x = segment.X; x != segment.X + segment.Width; ++x)
				{
					for (int y = segment.Y; y != segment.Y + segment.Height; ++y)
					{
						if (picture.IsBlue(x, y))
							result.Add(segment);
					}
				}
			}

			return result;
		}
	}
}
